﻿@model PagedList.IPagedList<Domain.BLL.ProductBLL>
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_MasterPage.cshtml";
    var imagefolder = "../../Images/ProductImages/";

    string[] Images; 
}
<script type="text/javascript">
    $("#tIdProducts").attr("class", "HeaderActTax accentBackgroundText");

</script>
<div id="S00" class="region regionGroup ">
    <h4 class="headingBase headingXL saHeadingXL">
        Go further. Do more.
    </h4>
    <p class="para">@Html.Raw(@ViewBag.Mota)</p>
</div>
<div id="S01" class="region regionGroup ">
    <div class="k-widget k-header" id="PagingBarOnTop" style="margin-bottom: 10px;">
        Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
        of @Model.PageCount
        @if (Model.HasPreviousPage)
        {
            @Html.ActionLink("<<", "Index", new { page = 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
            @Html.Raw(" ");
            @Html.ActionLink("< Prev", "Index", new { page = Model.PageNumber - 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
        }
        else
        {
            @:<<
        @Html.Raw(" ");
            @:< Prev
            }
        @if (Model.HasNextPage)
        {
            @Html.ActionLink("Next >", "Index", new { page = Model.PageNumber + 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
            @Html.Raw(" ");
            @Html.ActionLink(">>", "Index", new { page = Model.PageCount, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
        }
        else
        {
            @:Next >
        @Html.Raw(" ")
            @:>>
            }
    </div>
</div>
<div id="S02" class="region regionGroup " style = "min-height:500px">
    @foreach (var item in Model)
    {

        Images = item.ImageName.Split(';'); 
        <div class="prodPane">
            <div class="prodPaneImage">
                <a href="/Products/Details/@item.ProductID">
                    <img class="blkImg" src="@imagefolder@Images[0]" alt="Hình SP" /></a>
            </div>
            <div class="prodPaneHeading">
                <h2 class="headingBase headingS">@Html.DisplayFor(modelItem => item.ProductName)</h2>
            </div>
            <div class="prodPaneDesc">
                <div class="wolTextDesc">@Html.DisplayFor(modelItem => item.Description)</div>
            </div>
            <ul class="iListInnerList">
                <li>
                    <p class="para">@Html.ActionLink("Chi Tiết", "Details/", new { id = item.ProductID })</p>
                    <p>@Html.ActionLink("Add to Cart", "AddToCart", "ShoppingCart", new { id = item.ProductID }, "")</p>
                </li>
            </ul>
        </div>
 
    }
</div>
<div id="S03" class="region regionGroup ">
    <div class="k-widget k-header" id="PagingBarBottom" style="margin-bottom: 10px; display: block;">
        Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
        of @Model.PageCount
        @if (Model.HasPreviousPage)
        {
            @Html.ActionLink("<<", "Index", new { page = 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
            @Html.Raw(" ");
            @Html.ActionLink("< Prev", "Index", new { page = Model.PageNumber - 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
        }
        else
        {
            @:<<
        @Html.Raw(" ");
            @:< Prev
            }
        @if (Model.HasNextPage)
        {
            @Html.ActionLink("Next >", "Index", new { page = Model.PageNumber + 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
            @Html.Raw(" ");
            @Html.ActionLink(">>", "Index", new { page = Model.PageCount, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
        }
        else
        {
            @:Next >
        @Html.Raw(" ")
            @:>>
            }
    </div>
</div>
